/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2014 All Rights Reserved.
 */
package com.alipay.executor;

import net.sf.json.JSONObject;

import com.alipay.util.AlipayMsgBuildUtil;
import com.weigj.model.Client;

/**
 * 取消关注服务窗执行器
 * 
 * @author baoxing.gbx
 * @version $Id: InAlipayUnFollowExecutor.java, v 0.1 Jul 24, 2014 4:29:29 PM baoxing.gbx Exp $
 */
public class InAlipayUnFollowExecutor implements ActionExecutor {

    /** 业务参数 */
    private JSONObject bizContent;

    public InAlipayUnFollowExecutor(JSONObject bizContent) {
        this.bizContent = bizContent;
    }

    public InAlipayUnFollowExecutor() {
        super();
    }

    public String execute() {

        //取得发起请求的支付宝账号id
        final String fromUserId = bizContent.getString("FromUserId");

        //TODO 根据支付宝请求参数，开发者可以删除之前保存的本地支付宝UID-服务窗ID的关注关系
        //将客户的formUserId与系统的客户关联
        Client client=Client.dao.queryClientByFormUserId(fromUserId);
        client.set("", null);
        client.update();
        return AlipayMsgBuildUtil.buildBaseAckMsg(fromUserId);
    }
}
